# Contributor: Bohdan <chbgdn@gmail.com>
# Maintainer: Bohdan <chbgdn@gmail.com>
pkgname=hddfancontrol
pkgver=1.6.2
pkgrel=0
pkgdesc="Regulate fan speed according to hard drive temperature"
url="https://github.com/desbma/hddfancontrol"
arch="noarch"
license="GPL-3.0-or-later"
depends="py3-daemon"
makedepends="py3-gpep517 py3-wheel"
subpackages="$pkgname-pyc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/desbma/hddfancontrol/archive/$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m unittest -v tests
}

package() {
	python3 -m installer --dest="$pkgdir" .dist/*.whl

	install -Dm755 openrc/hddfancontrol "${pkgdir}/etc/init.d/hddfancontrol"
	install -Dm644 systemd/hddfancontrol.conf "${pkgdir}/etc/conf.d/hddfancontrol"
}

sha512sums="
1b974682e1a617049b1fbb6a3a9983e8f0e2c607284862468cb61e065cc2d3c52ca3a92c1d3fc2a02b5b9501e0a345b40f6a2a60c675889a40e4115890080e59  hddfancontrol-1.6.2.tar.gz
"
